<template>
	<van-action-bar class="submit-bar van-safe-area-bottom">
		<van-action-bar-icon icon="shop-o" @click="to('/shop/home',{shopId:props.shopId})">店铺</van-action-bar-icon>
		<van-action-bar-icon icon="chat-o" @click="displayCust">客服</van-action-bar-icon>
		<van-action-bar-icon icon="star-o">收藏</van-action-bar-icon>
		<van-action-bar-button v-if="!loading" type="warning" @click="handleCart">加采购车</van-action-bar-button>
		<van-action-bar-button v-if="!loading" type="primary" @click="handleBuy">立即订购</van-action-bar-button>
		<van-action-bar-button v-if="loading" type="primary" loading loading-text="加载中..."/>
	</van-action-bar>
	<cust-sheet :shop-id="shopId" v-model="showCust" ref="refCustSheet"/>
</template>
<style lang="scss" scoped>
.submit-bar{
	box-shadow: 4px 0 6px 0 rgba(0,0,0,.05);
	:deep(.van-button--primary){
		background: linear-gradient(90deg, #fff -250%, var(--van-primary-color) 100%);
	}
}
</style>
<script lang="ts" setup>
//props
const props = defineProps({
	shopId:{
		type:String,
		required:true
	},
	gdsId:{
		type:String,
		required:true
	},
	actionDisable:{
		type:Boolean,
		default:true,
	},
	showOther:{
		type:Boolean,
		default:true
	},
	loading:{
		type:Boolean,
		default:false,
	},
})
//emits
const emits=defineEmits(['handleCart','handleBuy'])

//data
const showCust=ref(false)
const refCustSheet=ref()

//methods
const {to} =useGoto()
const displayCust =()=>{
	refCustSheet.value.displayCustSheet()
}
const handleCart=()=>{
	emits('handleCart')
}
const handleBuy=()=>{
	emits('handleBuy')
}
</script>